<template>
    <div class="ItemList">
        <header>
            <slot name="title">默认分类</slot>
        </header>
        <div class="lists">
            <router-link :to="`/info/${item.goodsId}`" class="item" v-for="item in GoodsList" :key="item.goodsId">
                <img :src="item.goodsCoverImg" alt="" width="100%" style="display:block" />
                <div class="title">{{ item.goodsName }}</div>
                <div class="price">￥{{ item.sellingPrice.toFixed(2) }}</div>
            </router-link>
        </div>
    </div>

</template>

<script setup>
let props = defineProps(['GoodsList', 'title'])

</script>

<style scoped lang="less">
header {
    width: 100%;
    height: 1.4rem;
    background-color: #F9F9F9;
    line-height: 1.4rem;
    font-size: .45rem;
    color: grey;
    text-align: center;
}

.lists {
    width: 100%;
    background-color: #F9F9F9;

    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;

    .item {
        width: 49%;
        height: 6rem;
        background-color: #fff; 
        margin-bottom: 0.2rem;
        position: relative;

        img {
            width: 65%;
            height: auto;

            position: absolute;
            left: 1rem;
            top: .5rem;

        }

        .title {
            width: 93%;
            padding: 0 .2rem;
            text-overflow: ellipsis;
            font-size: .37rem;
            text-align: center;
            position: absolute;
            top: 4rem;
            color: black;

        }

        .price {
            color: darkred;
            font-size: .35rem;
            color: gray;
            position: absolute;
            top: 5.2rem;
            left: 1.6rem;

        }
    }
}
</style>